<?php
    require_once('framework/msc-load.php');
    require_once('framework/includes/session-handler.php');
    require_once('framework/msc-functions.php');
    require_once('framework/member-functions.php');
?>

<!DOCTYPE HTML>
<html>

<head>
    <title>MSC Hotels</title>
    
    <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
    <meta name="keywords" content="" />
    <meta name="description" content="">
    <meta name="author" content="MSC Team">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!-- GOOGLE FONTS -->
    <link href='http://fonts.googleapis.com/css?family=Roboto:400,300,100,500,700' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,400,300,600' rel='stylesheet' type='text/css'>
    <!-- /GOOGLE FONTS -->
    
    <link rel="stylesheet" href="assets/css/bootstrap.css">
    <link rel="stylesheet" href="assets/css/font-awesome.css">
    <link rel="stylesheet" href="assets/css/icomoon.css">
    <link rel="stylesheet" href="assets/css/styles.css">
    <script src="assets/js/modernizr.js"></script>
    
</head>

<body>

      <div class="global-wrap">
        <header id="main-header">
            <div class="header-top">
                <div class="container">
                    <div class="row">
                        <div class="col-md-3">
                            <a class="logo" href="index.php">
                                <img src="assets/img/logo-invert.png" alt="Image Alternative text" title="Image Title" />
                            </a>
                        </div>
                        <div class="col-md-5">
                            <h5 class="text-color">NOTICE: This is an experimental project.</h5>
                        </div>
                        <div class="col-md-4">
                            <div class="top-user-area clearfix">
                                <ul class="top-user-area-list list list-horizontal list-border">
                                    <?php if(isRegistered()): ?>
                                        <li class="top-user-area-avatar"><a href="user-profile.php">Hi, <?php echo NameShit(); ?></a></li>
                                        <li><a href="/logout.php">Log Out</a></li>
                                    <?php else: ?>
                                        <li class="top-user-area-avatar"><a>Hi, <?php echo getUserName(); ?></a></li>
                                        <li><a href="/signup.php">Log In</a></li>
                                    <?php endif; ?>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="container">
                <div class="nav">
                    <ul class="slimmenu" id="slimmenu">
                        <li class="active"><a href="index.php">Home</a></li>
                        <li><a href="listings.php">Hotels</a></li>
                    </ul>
                </div>
            </div>
        </header>
        
        <div class="container">
            <h1 class="page-title">Account Settings</h1>
        </div>
        
        <div class="container">
            <div class="row">
                <div class="col-md-3">
                    <aside class="user-profile-sidebar">
                        <div class="user-profile-avatar text-center">
                            <h5>Hi, <?php echo getUserName(); ?></h5>
                        </div>
                        <ul class="list user-profile-nav">
                             <li><a href="user-profile.php"><i class="fa fa-clock-o"></i>Booking History</a>
                            </li>
                            <li class="active"><a href="user-profile-settings.php"><i class="fa fa-cog"></i>Settings</a>
                            </li>
                          
                            </ul>
                    </aside>
                </div>
                <div class="col-md-9">
                    <div class="row">
                        <div class="col-md-5">
                            <form action="framework/member-functions.php" method="post">
                                <h4>Personal Infomation</h4>
                          
                                <?php $info = getUserInfo();  
												                    // redirect  messages for password change
						          if(isset($_GET['change'])){
							         if($_GET['change'] == 'firstname'){
								    echo '<font color="red">Firstname Changed</font>';
								 
							}else if($_GET['change'] == 'lastname'){
								echo '<font color="red"> Lastname changed</font>';
					
							}else if($_GET['change'] == 'phone'){
								echo '<font color="red"> Phone number changed</font>';
						}  		
                                  }             //end redirect messages
                                     
						?> 

                                <div class="form-group form-group-icon-left"><i class="fa fa-user input-icon"></i>
                                    <label>First Name</label>
                                    <input class="form-control" name = FirstName value=<?php echo $info['name']; ?> type="text" />
                                </div>
                                <div class="form-group form-group-icon-left"><i class="fa fa-user input-icon" ></i>
                                    <label>Last Name</label>
                                    <input class="form-control" name = LastName value=<?php echo $info['lastname']; ?> type="text" />
                                </div>
                                <div class="form-group form-group-icon-left"><i class="fa fa-envelope input-icon"></i>
                                    <label>E-mail</label>
                                    <input class="form-control" value=<?php echo $info['email']; ?> type="text" disabled />
                                </div>
                                <div class="form-group form-group-icon-left"><i class="fa fa-phone input-icon"></i>
                                    <label>Phone Number</label>
                                    <input class="form-control" name = PhoneNumber value=<?php echo $info['phone']; ?> type="text" />
                                </div>
                                <div class="gap gap-small"></div>
                                <hr />
                                <input class="btn btn-primary" type="submit" value="Change Info" name="changeinfo" />
                                <hr />
                                <hr />
                           </form>
                        </div>
                        <div class="col-md-4 col-md-offset-1">
                            <h4>Change Password</h4>
                            <form action= "framework/member-functions.php" method= "post">
                          <?php												// redirect  messages for password change
						          if(isset($_GET['status'])){
							         if($_GET['status'] == 'ok'){
								    echo '<font color="red">Password Changed</font>';
								 
							}else if($_GET['status'] == 'short'){
								echo '<font color="red"> password strength or invalid E-mail problem</font>';
					
							}else if($_GET['status'] == 'mismatched'){
								echo '<font color="red"> There is a mismatch in passwords, please type again</font>';
						}  		
                                  }             //end redirect messages
                                     
						?> 
                                
                                <div class="form-group form-group-icon-left"><i class="fa fa-lock input-icon"></i>
                                    <label>Current Password</label>
                                    <input class="form-control" name="current_password" type="password" required="required" />
                                </div>
                                <div class="form-group form-group-icon-left"><i class="fa fa-lock input-icon"></i>
                                    <label>New Password</label>
                                    <input class="form-control" name="new_password"  type="password" required="required"/>
                                </div>
                                <div class="form-group form-group-icon-left"><i class="fa fa-lock input-icon"></i>
                                    <label>New Password Again</label>
                                    <input class="form-control" name="new_password_again" type="password" required="required" />
                                </div>
                                <hr />
                                <input class="btn btn-primary" type="submit" value="Change Password" name = "changepassword"/>
                                <hr />
                                <hr />
                            
                            </form>
                        </div>
                            <div class="col-md-4 col-md-offset-1">
                                <form action="framework/member-functions.php" method="post">
                                <input class="btn btn-primary" type="submit" name="delete" value="Deactivate Account" /> 
                                </form>
                            </div>
                        </div>
                </div>
            </div>
        </div>

        <div class="gap"></div>
              
        <footer id="main-footer">
            <div class="container">
                <div class="row row-wrap">
                    <div class="col-md-3">
                        <a class="logo" href="index.php">
                            <img src="assets/img/logo-invert.png" alt="Image Alternative text" title="Image Title" />
                        </a>
                        <p class="mb20">Booking, reviews and advices on hotels and lots more!</p>
                        <ul class="list list-horizontal list-space">
                            <li>
                                <a class="fa fa-facebook box-icon-normal round animate-icon-bottom-to-top" href="#"></a>
                            </li>
                            <li>
                                <a class="fa fa-twitter box-icon-normal round animate-icon-bottom-to-top" href="#"></a>
                            </li>
                            <li>
                                <a class="fa fa-google-plus box-icon-normal round animate-icon-bottom-to-top" href="#"></a>
                            </li>
                            <li>
                                <a class="fa fa-linkedin box-icon-normal round animate-icon-bottom-to-top" href="#"></a>
                            </li>
                            <li>
                                <a class="fa fa-pinterest box-icon-normal round animate-icon-bottom-to-top" href="#"></a>
                            </li>
                        </ul>
                    </div>
                    <div class="col-md-4">
                        <h4>Have Questions?</h4>
                        <h5><a href="#" class="text-color">al.s.katsaros@gmail.com</a></h5>
                        <h5><a href="#" class="text-color">cskostas@gmail.com</a></h5>
                        <h5><a href="#" class="text-color">g.gravanis@gmail.com</a></h5>
                        <h5><a href="#" class="text-color">grgstoupas@gmail.com</a></h5>
                        <p>24/7 Dedicated Customer Support</p>
                    </div>
                    <div id="project-details" class="col-md-5">
                        <h4>This is an experimental project</h4>
                        <h5 class="text-color">based on "Software Engineering for Web Applications" course of "Master of Science (MSc) in Web Intelligence"</h5>
                        <a href="http://msc.it.teithe.gr/" target="_blank"><img src="assets/img/logo-swk-final-s.png" alt="" style="width:80%;" /></a>
                    </div>
                </div>
            </div>
        </footer>

        <script src="assets/js/jquery.js"></script>
        <script src="assets/js/bootstrap.js"></script>
        <script src="assets/js/slimmenu.js"></script>
        <script src="assets/js/bootstrap-datepicker.js"></script>
        <script src="assets/js/bootstrap-timepicker.js"></script>
        <script src="assets/js/nicescroll.js"></script>
        <script src="assets/js/dropit.js"></script>
        <script src="assets/js/ionrangeslider.js"></script>
        <script src="assets/js/icheck.js"></script>
        <script src="assets/js/fotorama.js"></script>
        <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
        <script src="assets/js/typeahead.js"></script>
        <script src="assets/js/card-payment.js"></script>
        <script src="assets/js/magnific.js"></script>
        <script src="assets/js/owl-carousel.js"></script>
        <script src="assets/js/fitvids.js"></script>
        <script src="assets/js/tweet.js"></script>
        <script src="assets/js/countdown.js"></script>
        <script src="assets/js/gridrotator.js"></script>
        <script src="assets/js/custom.js"></script>
    </div>
</body>

</html>